home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / comm1 / intsdkss.lha / include / netinet / tcp_var.h < prev    next >
C/C++ Source or Header  |  1996-04-09  |  9KB  |  239 lines

  1. #ifndef NETINET_TCP_VAR_H
  2. #define NETINET_TCP_VAR_H
  3. /*
  4.  * Copyright (c) 1982, 1986 Regents of the University of California.
  5.  * All rights reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms are permitted
  8.  * provided that the above copyright notice and this paragraph are
  9.  * duplicated in all such forms and that any documentation,
  10.  * advertising materials, and other materials related to such
  11.  * distribution and use acknowledge that the software was developed
  12.  * by the University of California, Berkeley.  The name of the
  13.  * University may not be used to endorse or promote products derived
  14.  * from this software without specific prior written permission.
  15.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  16.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  17.  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  18.  *
  19.  *    @(#)tcp_var.h   7.8 (Berkeley) 6/29/88
  20.  */
  21.  
  22. /*
  23.  * TCP configuration:  This is a half-assed attempt to make TCP
  24.  * self-configure for a few varieties of 4.2 and 4.3-based unixes.
  25.  * If you don't have a) a 4.3bsd vax or b) a 3.x Sun (x<6), check
  26.  * this carefully (it's probably not right).  Please send me mail
  27.  * if you run into configuration problems.
  28.  *  - Van Jacobson (van@lbl-csam.arpa)
  29.  */
  30.  
  31. #ifndef BSD
  32. #define BSD 42    /* if we're not 4.3, pretend we're 4.2 */
  33. #define OLDSTAT /* set if we have to use old netstat binaries */
  34. #endif
  35.  
  36. /* #define OLDSTAT    /* set if we have to use old netstat binaries */
  37.  
  38. #if sun || BSD < 43
  39. #define TCP_COMPAT_42    /* set if we have to interop w/4.2 systems */
  40. #endif
  41.  
  42. #ifndef SB_MAX
  43. #ifdef    SB_MAXCOUNT
  44. #define SB_MAX    SB_MAXCOUNT    /* Sun has to be a little bit different... */
  45. #else
  46. #define SB_MAX    (64*1024)       /* XXX */
  47. #endif    /* SB_MAXCOUNT */
  48. #endif    /* SB_MAX */
  49.  
  50. #ifndef IP_MAXPACKET
  51. #define IP_MAXPACKET    65535    /* maximum packet size */
  52. #endif
  53.  
  54. /*
  55.  * Bill Nowicki pointed out that the page size (CLBYTES) has
  56.  * nothing to do with the mbuf cluster size.  So, we followed
  57.  * Sun's lead and made the new define MCLBYTES stand for the mbuf
  58.  * cluster size.  The following define makes up backwards compatible
  59.  * with 4.3 and 4.2.  If CLBYTES is >1024 on your machine, check
  60.  * this against the mbuf cluster definitions in /usr/include/sys/mbuf.h.
  61.  */
  62. #ifndef MCLBYTES
  63. #define MCLBYTES CLBYTES    /* XXX */
  64. #endif
  65.  
  66. /*
  67.  * The routine in_localaddr is broken in Sun's 3.4.  We redefine ours
  68.  * (in tcp_input.c) so we use can it but won't have a name conflict.
  69.  */
  70. #ifdef sun
  71. #define in_localaddr tcp_in_localaddr
  72. #endif
  73.  
  74. /* --------------- end of TCP config ---------------- */
  75.  
  76. /*
  77.  * Kernel variables for tcp.
  78.  */
  79.  
  80. /*
  81.  * Tcp control block, one per tcp; fields:
  82.  */
  83. struct tcpcb {
  84.     struct    tcpiphdr *seg_next;    /* sequencing queue */
  85.     struct    tcpiphdr *seg_prev;
  86.     short    t_state;        /* state of this connection */
  87.     short    t_timer[TCPT_NTIMERS];    /* tcp timers */
  88.     short    t_rxtshift;        /* log(2) of rexmt exp. backoff */
  89.     short    t_rxtcur;        /* current retransmit value */
  90.     short    t_dupacks;        /* consecutive dup acks recd */
  91.     u_short t_maxseg;        /* maximum segment size */
  92.     char    t_force;        /* 1 if forcing out a byte */
  93.     u_char    t_flags;
  94. #define TF_ACKNOW    0x01        /* ack peer immediately */
  95. #define TF_DELACK    0x02        /* ack, but try to delay it */
  96. #define TF_NODELAY    0x04        /* don't delay packets to coalesce */
  97. #define TF_NOOPT    0x08        /* don't use tcp options */
  98. #define TF_SENTFIN    0x10        /* have sent FIN */
  99.     struct    tcpiphdr *t_template;    /* skeletal packet for transmit */
  100.     struct    inpcb *t_inpcb;     /* back pointer to internet pcb */
  101. /*
  102.  * The following fields are used as in the protocol specification.
  103.  * See RFC783, Dec. 1981, page 21.
  104.  */
  105. /* send sequence variables */
  106.     tcp_seq snd_una;        /* send unacknowledged */
  107.     tcp_seq snd_nxt;        /* send next */
  108.     tcp_seq snd_up;         /* send urgent pointer */
  109.     tcp_seq snd_wl1;        /* window update seg seq number */
  110.     tcp_seq snd_wl2;        /* window update seg ack number */
  111.     tcp_seq iss;            /* initial send sequence number */
  112.     u_short snd_wnd;        /* send window */
  113. /* receive sequence variables */
  114.     u_short rcv_wnd;        /* receive window */
  115.     tcp_seq rcv_nxt;        /* receive next */
  116.     tcp_seq rcv_up;         /* receive urgent pointer */
  117.     tcp_seq irs;            /* initial receive sequence number */
  118. /*
  119.  * Additional variables for this implementation.
  120.  */
  121. /* receive variables */
  122.     tcp_seq rcv_adv;        /* advertised window */
  123. /* retransmit variables */
  124.     tcp_seq snd_max;        /* highest sequence number sent
  125.                      * used to recognize retransmits
  126.                      */
  127. /* congestion control (for slow start, source quench, retransmit after loss) */
  128.     u_short snd_cwnd;        /* congestion-controlled window */
  129.     u_short snd_ssthresh;        /* snd_cwnd size threshhold for
  130.                      * for slow start exponential to
  131.                      * linear switch */
  132. /*
  133.  * transmit timing stuff.
  134.  * srtt and rttvar are stored as fixed point; for convenience in smoothing,
  135.  * srtt has 3 bits to the right of the binary point, rttvar has 2.
  136.  * "Variance" is actually smoothed difference.
  137.  */
  138.     short    t_idle;         /* inactivity time */
  139.     short    t_rtt;            /* round trip time */
  140.     tcp_seq t_rtseq;        /* sequence number being timed */
  141.     short    t_srtt;         /* smoothed round-trip time */
  142.     short    t_rttvar;        /* variance in round-trip time */
  143.     u_short max_rcvd;        /* most peer has sent into window */
  144.     u_short max_sndwnd;        /* largest window peer has offered */
  145. /* out-of-band data */
  146.     char    t_oobflags;        /* have some */
  147.     char    t_iobc;         /* input character */
  148. #define TCPOOB_HAVEDATA 0x01
  149. #define TCPOOB_HADDATA    0x02
  150. };
  151.  
  152. #define intotcpcb(ip)   ((struct tcpcb *)(ip)->inp_ppcb)
  153. #define sototcpcb(so)   (intotcpcb(sotoinpcb(so)))
  154.  
  155. /*
  156.  * TCP statistics.
  157.  * Many of these should be kept per connection,
  158.  * but that's inconvenient at the moment.
  159.  */
  160. struct    tcpstat {
  161. #ifdef OLDSTAT
  162.     /*
  163.      * Declare statistics the same as in 4.3
  164.      * at the start of tcpstat (same size and
  165.      * position) for netstat.
  166.      */
  167.     int    tcps_rcvbadsum;
  168.     int    tcps_rcvbadoff;
  169.     int    tcps_rcvshort;
  170.     int    tcps_badsegs;
  171.     int    tcps_unack;
  172. #define tcps_badsum    tcps_rcvbadsum
  173. #define tcps_badoff    tcps_rcvbadoff
  174. #define tcps_hdrops    tcps_rcvshort
  175.  
  176. #endif /* OLDSTAT */
  177.     u_long    tcps_connattempt;    /* connections initiated */
  178.     u_long    tcps_accepts;        /* connections accepted */
  179.     u_long    tcps_connects;        /* connections established */
  180.     u_long    tcps_drops;        /* connections dropped */
  181.     u_long    tcps_conndrops;     /* embryonic connections dropped */
  182.     u_long    tcps_closed;        /* conn. closed (includes drops) */
  183.     u_long    tcps_segstimed;     /* segs where we tried to get rtt */
  184.     u_long    tcps_rttupdated;    /* times we succeeded */
  185.     u_long    tcps_delack;        /* delayed acks sent */
  186.     u_long    tcps_timeoutdrop;    /* conn. dropped in rxmt timeout */
  187.     u_long    tcps_rexmttimeo;    /* retransmit timeouts */
  188.     u_long    tcps_persisttimeo;    /* persist timeouts */
  189.     u_long    tcps_keeptimeo;     /* keepalive timeouts */
  190.     u_long    tcps_keepprobe;     /* keepalive probes sent */
  191.     u_long    tcps_keepdrops;     /* connections dropped in keepalive */
  192.  
  193.     u_long    tcps_sndtotal;        /* total packets sent */
  194.     u_long    tcps_sndpack;        /* data packets sent */
  195.     u_long    tcps_sndbyte;        /* data bytes sent */
  196.     u_long    tcps_sndrexmitpack;    /* data packets retransmitted */
  197.     u_long    tcps_sndrexmitbyte;    /* data bytes retransmitted */
  198.     u_long    tcps_sndacks;        /* ack-only packets sent */
  199.     u_long    tcps_sndprobe;        /* window probes sent */
  200.     u_long    tcps_sndurg;        /* packets sent with URG only */
  201.     u_long    tcps_sndwinup;        /* window update-only packets sent */
  202.     u_long    tcps_sndctrl;        /* control (SYN|FIN|RST) packets sent */
  203.  
  204.     u_long    tcps_rcvtotal;        /* total packets received */
  205.     u_long    tcps_rcvpack;        /* packets received in sequence */
  206.     u_long    tcps_rcvbyte;        /* bytes received in sequence */
  207. #ifndef OLDSTAT
  208.     u_long    tcps_rcvbadsum;     /* packets received with ccksum errs */
  209.     u_long    tcps_rcvbadoff;     /* packets received with bad offset */
  210.     u_long    tcps_rcvshort;        /* packets received too short */
  211. #endif
  212.     u_long    tcps_rcvduppack;    /* duplicate-only packets received */
  213.     u_long    tcps_rcvdupbyte;    /* duplicate-only bytes received */
  214.     u_long    tcps_rcvpartduppack;    /* packets with some duplicate data */
  215.     u_long    tcps_rcvpartdupbyte;    /* dup. bytes in part-dup. packets */
  216.     u_long    tcps_rcvoopack;     /* out-of-order packets received */
  217.     u_long    tcps_rcvoobyte;     /* out-of-order bytes received */
  218.     u_long    tcps_rcvpackafterwin;    /* packets with data after window */
  219.     u_long    tcps_rcvbyteafterwin;    /* bytes rcvd after window */
  220.     u_long    tcps_rcvafterclose;    /* packets rcvd after "close" */
  221.     u_long    tcps_rcvwinprobe;    /* rcvd window probe packets */
  222.     u_long    tcps_rcvdupack;     /* rcvd duplicate acks */
  223.     u_long    tcps_rcvacktoomuch;    /* rcvd acks for unsent data */
  224.     u_long    tcps_rcvackpack;    /* rcvd ack packets */
  225.     u_long    tcps_rcvackbyte;    /* bytes acked by rcvd acks */
  226.     u_long    tcps_rcvwinupd;     /* rcvd window update packets */
  227. };
  228.  
  229. #ifdef KERNEL
  230. #if 0
  231. extern struct inpcb tcb;        /* head of queue of active tcpcb's */
  232. extern struct tcpstat tcpstat;        /* tcp statistics */
  233. struct tcpiphdr *tcp_template();
  234. struct tcpcb *tcp_close(), *tcp_drop();
  235. struct tcpcb *tcp_timers(), *tcp_disconnect(), *tcp_usrclosed();
  236. #endif
  237. #endif /* KERNEL */
  238. #endif
  239.